<template>
	<view class="login">
		<view class="flex_box login-box flex_direction">
			<u-image src="/static/logo.png"></u-image>
			<u-button type="error" shape="circle" 
			 @getphonenumber="getPhoneNumber"
			 open-type="getPhoneNumber">一键登录</u-button>
		</view>
	</view>
</template>

<script>
	import { login } from '@/common/js/http.api.js';
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			getPhoneNumber: async (e) => {
			    let res = await login(e.detail);
				uni.$u.toast(res.msg);
				if (res.code == 1) {
					uni.setStorageSync('loginStatus', 2);
					uni.setStorageSync('token', res.data.token);
					uni.switchTab({
						'url': '/pages/my/my'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.login {
		padding: 0 30rpx;
		.login-box {
			margin-top: 300rpx;
		}
	}
</style>
